package it.unibz.easytravel.common;

import it.unibz.easytravel.db.PersonDbAdapter;
import it.unibz.easytravel.db.TravellersDbAdapter;
import android.app.Activity;

public class Person {

	private String name;
	private int money=0;
	private String phoneNumber;
	
	public Person(String name){
		this.name = name;
	}
	
	public Person(String name, int money){
		this.name = name;
		this.money = money;
	}

	public Person(String name, String phoneNumber) {
		this.name = name;
		this.phoneNumber = phoneNumber;
	}
	
	public Person(int id, int moneyFlow, Activity act) {
		this.money = moneyFlow;
		this.name = getName(id, act);
	}

	public static String getName(int id, Activity act){
		PersonDbAdapter mPersonDb = new PersonDbAdapter(act);
		mPersonDb.open();
		String name = mPersonDb.getName(id);
		mPersonDb.close();
		return name;
	}
	
	public String getPhoneNumber() {
		return phoneNumber;
	}
	
	public String getName(){
		return name;
	}
	
	public int getMoney(){
		return this.money;
	}
	
	public void addMoney(int money){
		this.money += money;
	}
	
	public String toString(){
		return name+" "+money+"\n";
	}

	public String getId() {
		// TODO Auto-generated method stub
		return null;
	}
}
